Supporta il tuo Forum su Patreon!
 
  > Register  
  > Calendar  
  > Member List  
 
  > Support your Forum  
  > Today's Posts  
   

Go Back   netgamers.it > Tech & Tech > Developer's Zone

Reply
 
Thread Tools Rate Thread
Old 25th August 2007, 23:49   #61
*Altair*
Premium Netgamers
 
*Altair*'s Avatar
 
Join Date: Dec 2000
Posts: 7,094
guardando i thread con le risposte ai problemi svolti, mi ha colpito molto la totale leggibilità del linguaggio J. Ad esempio una soluzione per il problema 4 è

Spoiler:

>([:{: ]#~ (=|.&.>)) <@":"0 /:~(0:-.~[:,>:/**/)~(i.100)-.~i.1000


ed io che denigravo haskell...
__________________
postcount++;
*Altair* is offline   Reply With Quote
Old 26th August 2007, 00:06   #62
.Z.
fork()
 
.Z.'s Avatar
 
Join Date: Jan 2002
Location: Bologna
Posts: 13,783
Quote:
Originally Posted by .Z. View Post
Non l'ho risolto ma lo interpreto cosi
Sì, è così.
__________________
Personally, I would never want to be a member of any group where you either have to wear a hat, or you can't wear a hat.
.Z. is offline   Reply With Quote
Old 26th August 2007, 00:32   #63
*Altair*
Premium Netgamers
 
*Altair*'s Avatar
 
Join Date: Dec 2000
Posts: 7,094
ok, ora l'ho risolto, non avevo capito la domanda
anche perchè l'esempio che avevi fatto comprendeva entrambi i casi in discussione

che fdm, ora mi nascondo dalla vergogna
__________________
postcount++;

Last edited by *Altair*; 26th August 2007 at 00:34.
*Altair* is offline   Reply With Quote
Old 26th August 2007, 11:43   #64
Darklord
lupetto supremo
 
Darklord's Avatar
 
Join Date: Mar 1999
Location: Bari
Posts: 12,829
J, K e APL...solo i matematici sono così pazzi da amarli
__________________
Python-foo Black Belt
NGI Forum
» Tech & Tech » Developer's Zone
Darklord is offline   Reply With Quote
Old 5th September 2007, 23:07   #65
Doriän
~
 
Doriän's Avatar
 
Join Date: Jan 2006
Posts: 1,993
Quote:
Originally Posted by *Altair* View Post
guardando i thread con le risposte ai problemi svolti, mi ha colpito molto la totale leggibilità del linguaggio J. Ad esempio una soluzione per il problema 4 è

Spoiler:

>([:{: ]#~ (=|.&.>)) <@":"0 /:~(0:-.~[:,>:/**/)~(i.100)-.~i.1000


ed io che denigravo haskell...

Nemmeno ce l'ho la tilde nella tastiera , come presumo la maggior parte degli italiani asd.
__________________
rm is like a knife where the handle has a sharp edge too.
Doriän is offline   Reply With Quote
Old 24th September 2007, 15:38   #66
Lord Razor
dorky nerd
 
Lord Razor's Avatar
 
Join Date: Jul 2000
Location: Vicolo
Posts: 987
io ho il 20 che mi sta smanettando da almeno 2 ore... e il bello e' che e' giusto! (per i numeri bassi funziona...)
__________________
WorldOfWarcraft: Cludus, Galene
Starcraft2: Lmao
BattleField3: JarheadSmau
Lord Razor is offline   Reply With Quote
Old 24th September 2007, 19:31   #67
.Z.
fork()
 
.Z.'s Avatar
 
Join Date: Jan 2002
Location: Bologna
Posts: 13,783
Io quelli con le cifre dei fattoriali non sono ancora riuscito a risolverli.

Per numeri piccoli ti funzia perché non va in overflow. Il fattoriale di 100 ha una marea di cifre
__________________
Personally, I would never want to be a member of any group where you either have to wear a hat, or you can't wear a hat.
.Z. is offline   Reply With Quote
Old 14th December 2007, 23:58   #68
.Z.
fork()
 
.Z.'s Avatar
 
Join Date: Jan 2002
Location: Bologna
Posts: 13,783
Code:
;;; Problem 1
;;;
;;; If we list all the natural numbers below 10 that are multiples of 3 or 5,
;;; we get 3, 5, 6 and 9. The sum of these multiples is 23.
;;;
;;; Find the sum of all the multiples of 3 or 5 below 1000.

(let ((sum 0))
  (dotimes (i 1000)
    (and (or (= 0 (mod i 3))
             (= 0 (mod i 5)))
         (incf sum i)))
  (print sum))
Cominciamo pian pianino...
__________________
Personally, I would never want to be a member of any group where you either have to wear a hat, or you can't wear a hat.
.Z. is offline   Reply With Quote
Old 15th December 2007, 00:50   #69
.Z.
fork()
 
.Z.'s Avatar
 
Join Date: Jan 2002
Location: Bologna
Posts: 13,783
Code:
;;; Problem 2
;;;
;;; Each new term in the Fibonacci sequence is generated by adding the
;;; previous two terms. By starting with 1 and 2, the first 10 terms will be:
;;;
;;; 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
;;;
;;; Find the sum of all the even-valued terms in the sequence which do not
;;; exceed one million.

(print (do ((sum 0)
            (cur 0 next)
            (next 1 (+ cur next)))
         ((>= cur 1000000) sum)
         (if (= 0 (mod cur 2)) (incf sum cur))))
Ci sto prendendo gusto
__________________
Personally, I would never want to be a member of any group where you either have to wear a hat, or you can't wear a hat.
.Z. is offline   Reply With Quote
Old 15th December 2007, 14:14   #70
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
in queste cose i linguaggi funzionali rullano di bestia
__________________
Lode a Bacco, in saecula saeculorum.
Emergent
Aresio is offline   Reply With Quote
Old 14th February 2008, 14:21   #71
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
Code:
Spoiler:
(defun fibonacci (n m stop &optional (last 0) (acc 0)) (cond ((>= m stop) acc) (T (if (even m) (fibonacci m (+ n m) stop n (+ acc m)) (fibonacci m (+ n m) stop n acc) ) ) ) ) (defun even (n) (if (= (mod n 2) 0) nil T) )
mi è arrivato un po' di spam dal progetto, ne ho approfittato per rinfrescare LISP
__________________
Lode a Bacco, in saecula saeculorum.
Emergent
Aresio is offline   Reply With Quote
Old 11th March 2008, 17:20   #72
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
Code:
Spoiler:
defun divide (m n) (if (= 0 (mod m n)) T nil)) (defun fatt (num acc lista) (if (> acc num) (car lista) ; fine (if (divide num acc) (fatt (/ num acc) acc (cons acc lista)) (fatt num (+ 1 acc) lista) ) ) )
problema numero 3, in LISP
__________________
Lode a Bacco, in saecula saeculorum.
Emergent
Aresio is offline   Reply With Quote
Old 11th March 2008, 22:50   #73
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
...evoluzione per risolvere il 7

Code:
Spoiler:
(defun primo (numero) (if (= numero (car (fatt numero 2 nil))) T nil) ) (defun collect (tetto prova tot lista) (if (> tot tetto) lista (if (primo prova) (collect tetto (+ prova 1) (+ 1 tot) (cons prova lista)) (collect tetto (+ prova 1) tot lista) ) ) )
LIEVEMENTE lento, ma funziona
__________________
Lode a Bacco, in saecula saeculorum.
Emergent
Aresio is offline   Reply With Quote
Old 11th March 2008, 23:13   #74
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
lol, sto facendo il 10, LISPworks sta macinando da 10 minuti al 98% del processore
__________________
Lode a Bacco, in saecula saeculorum.
Emergent
Aresio is offline   Reply With Quote
Old 11th March 2008, 23:28   #75
Aresio
Soft computer
 
Aresio's Avatar
 
Join Date: Feb 2000
Posts: 540
ok, è quasi mezzora che va. sposto la computazione sul PC dell'ufficio

edit: Lispworks free ha un limite computazionale di 6 ore. morale, si è chiuso
__________________
Lode a Bacco, in saecula saeculorum.
Emergent

Last edited by Aresio; 12th March 2008 at 09:25.
Aresio is offline   Reply With Quote
Reply

Tags
euler, matematica

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:23.



Copyright 2017-2024 by netgamers.it