YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -19,6 +19,6 @@ The task is to implement the algorithm:
# The 'user alert' should not stop processing of other items of the sequence.
# Print a prompt before accepting '''eleven''', textual, numeric inputs.
# You may optionally print the item as well as its associated result, but the results must be in reverse order of input.
# The sequence S may be 'implied' and so not shown explicitly.
# The sequence   ''' ''S'' '''   may be 'implied' and so not shown explicitly.
# ''Print and show the program in action from a typical run here''. (If the output is graphical rather than text then either add a screendump or describe textually what is displayed).
<br><br>

View file

@ -1,6 +1,3 @@
/* Abhishek Ghosh
27th August, 2012 */
#include<math.h>
#include<stdio.h>

View file

@ -1,10 +1,16 @@
import Control.Monad (replicateM, mapM_)
f x = (abs x) ** 0.5 + 5 * x ** 3
f :: Floating a => a -> a
f x = sqrt (abs x) + 5 * x ** 3
main :: IO ()
main = do
putStrLn "Enter 11 numbers for evaluation"
x <- replicateM 11 $ readLn
mapM_ ((\x -> if x > 400
then putStrLn "OVERFLOW"
else print x). f) $ reverse x
putStrLn "Enter 11 numbers for evaluation"
x <- replicateM 11 readLn
mapM_
((\x ->
if x > 400
then putStrLn "OVERFLOW"
else print x) .
f) $
reverse x

View file

@ -1,14 +1,11 @@
#!/usr/bin/perl
use strict ;
use warnings ;
my $number ;
my @sequence ;
print "Please enter 11 numbers!\n" ;
for my $i ( 0..10 ) {
$number = <STDIN> ;
chomp $number ;
push @sequence , $number ;
print "Enter 11 numbers:\n";
for ( 1..11 ) {
$number = <STDIN>;
chomp $number;
push @sequence, $number;
}
for $n (reverse @sequence) {
my $result = sqrt( abs($n) ) + 5 * $n**3;
printf "f( %6.2f ) %s\n", $n, $result > 400 ? " too large!" : sprintf "= %6.2f", $result
}
map { my $result = sqrt( abs ( $_ ) ) + 5 * $_** 3 ; print "f( $_ ) " ; $result > 400 ? print "too large!\n" : print ": $result\n" ; }
reverse @sequence ;

View file

@ -4,7 +4,7 @@ parse arg N .; if N=='' | N=="," then N=11 /*Not specified? Then use the
maxValue= 400 /*the maximum value f(x) can have. */
wid= 20 /* ··· but only show this many digits.*/
frac= 5 /* ··· show this # of fractional digs.*/
say ' _____ ' /* ◄───── display a vinculum.*/
say ' _____' /* ◄─── this SAY displays a vinculum.*/
say 'function: ƒ(x) x + (5 * x^3)'
prompt= 'enter ' N " numbers for the Trabb─Pardo─Knuth algorithm: (or Quit)"

View file

@ -1,7 +1,4 @@
# Project : Trabb PardoKnuth algorithm
# Date : 2017/10/06
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
decimals(3)
x = list(11)